package com.shell.governor.modules.controller;

import com.shell.bee.base.annotation.Logging;
import com.shell.bee.entity.mvc.RetMsg;
import com.shell.bee.persistence.model.PageLimit;
import com.shell.governor.modules.po.PubNotice;
import com.shell.governor.modules.service.PubNoticeService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class PubNoticeController {
	@Autowired
	private PubNoticeService noticeService;

	@RequestMapping
	@Logging(module = "��������", methods = "������������")
	public List<PubNotice> getNotices(PageLimit limit, PubNotice notice) {
		return this.noticeService.getNoticeByPage(limit, notice);
	}

	@RequestMapping
	@Logging(module = "��������", methods = "������������")
	public RetMsg deleteNotice(PubNotice notice) {
		return this.noticeService.deleteNotice(notice);
	}

	@RequestMapping
	@Logging(module = "��������", methods = "������������������")
	public RetMsg saveOrUpdateNotice(PubNotice notice, String fileIds) throws Exception {
		return this.noticeService.saveOrUpdateNotice(notice, fileIds);
	}

	@RequestMapping
	@Logging(module = "��������", methods = "������������������")
	public PubNotice getNoticeDetail(String noticeId) {
		return (PubNotice) this.noticeService.selectByKey(noticeId);
	}

	@RequestMapping
	@Logging(module = "��������", methods = "��������������������")
	public List<PubNotice> getAllNotices(PubNotice notice) {
		return this.noticeService.getAllNotices(notice);
	}

	@RequestMapping
	@Logging(module = "��������", methods = "������������")
	public RetMsg updateNoticeState(String noticeId, String noticeState) throws Exception {
		return this.noticeService.updateNoticeState(noticeId, noticeState);
	}
}
